#include <fstream>
#include <iostream>
#include "convex_hull.h"
#include <string>

int main()
{
   int n;
   std::vector<point> answ;

   std::cin >> n;
   point * points = new point [n];

   for(int i = 0; i < n; i++)
      std::cin >> points[i].x >> points[i].y;

   answ = graham_scan(points, n);

   std::cout << answ.size() << "\n";
   std::cout.precision(20);
   for (size_t i = 0; i < answ.size(); i++)
      std::cout << answ[i].x << " " << answ[i].y << "\n";

   return 0;
}